Carbon


SndCallBackProcPtr

Header: Sound.h Carbon status: Supported

Defines a pointer to a sound callback function. Your sound function executes whenever your application issues the callBackCmd command.

typedef void(* SndCallBackProcPtr) (
    SndChannelPtr chan, 
    SndCommand *cmd
);

You would declare your function like this if you were to name it MySndCallBackCallback:

void MySndCallBackCallback (
    SndChannelPtr chan, 
    SndCommand *cmd
);
Parameter descriptions
chan

A pointer to the sound channel on which a callBackCmd command was issued.

cmd

The sound command structure in which a callBackCmd command was issued.

DISCUSSION

The Sound Manager executes the callback function associated with a sound channel whenever it processes a callBackCmd command for the channel.

You can use a callback function to set a global flag that alerts the application that it must dispose of the sound channel. Or, you can use a callback function so that your application can synchronize a series of sound commands with other actions.

You can specify a callback function as the fourth parameter to the SndNewChannel function.

SPECIAL CONSIDERATIONS

A callback function is called at interrupt time. It must not make any calls to the Memory Manager, either directly or indirectly. If your callback function needs to access your application’s global variables, you must ensure that register A5 contains your application’s A5. (You can use the userInfo field of the sound channel pointed to by the theChan parameter or the param2 field of the sound command specified in the theCmd parameter to pass that value to your callback function.)


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)